package oop8;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class DivLog4j {
    public static final Logger Log= LoggerFactory.getLogger("oop8.DivLog4j");
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        if(Log.isDebugEnabled()){
            Log.debug("开始计算两个数的除法了！");
        }
        try {
            System.out.println("请输入1个数：");
            int a = in.nextInt();
            System.out.println("请输入第二个数：");
            int b = in.nextInt();
            int shang = a / b;
            Log.info(a + "/" + b + "=" + shang);
        } catch (ArithmeticException  e){
            Log.error("除法出错了",e);
        }catch (InputMismatchException e){
            Log.error("输入出错了",e);
        }finally {
            Log.warn("计算结束了");
            Log.warn("over");
        }

    }
}
